network object

This method will send an unreliable packet to a given peer.

bool send_unreliable(uint peer_id, string packet, int channel)

Parameters:
peer_id
The unique ID of the peer that is to receive the message.
packet
The message to be sent.
channel
The channel that the message should be sent on.

Return value:
true on success, false on failure.

Remarks:
This method sends an unreliable packet to a given peer, or to all connected peers if the peer ID is set to 0.

Unreliable packets are by far the quickest way of getting data across to another person. An unreliable packet will be sent at the maximum speed provided by the connection, but is not guaranteed to arrive at the destination. It is, however, guaranteed to be properly sequenced if it does arrive. Unreliable packets are useful when you have data that needs to be sent out very frequently, but you only really care about the most recent data. You are not particularly interested in another player's position from 2 seconds ago, for instance, but rather you want to know where they are at this very moment.

For more information about the differences between unreliable and reliable packets, as well as information about how to sequence packets using channels, see the main network chapter.

Example:
See the main network chapter.